package xyz.riceball.usercore.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import xyz.riceball.framework.core.bean.ApiR;
import xyz.riceball.usercore.entity.dto.UserDTO;
import xyz.riceball.usercore.entity.po.UserPO;

import java.util.List;

/**
 * 用户表(User)表服务接口
 *
 * @author xiaovcloud
 * @since 2022-04-24 20:17:51
 */
public interface UserService extends IService<UserPO> {
    /**
     * 根据用户名获取用户
     *
     * @param username
     * @return
     */
    UserPO getByUsername(String username);

    /**
     * 获取当前用户
     *
     * @param token
     * @return
     */
    UserDTO getCurrentUser(String token);

    /**
     * 新增用户
     *
     * @param userPO
     * @return
     */
    boolean add(UserPO userPO);

    /**
     * 编辑用户
     *
     * @param userPO
     * @return
     */
    boolean edit(UserPO userPO);

    /**
     * 删除用户
     *
     * @param ids
     * @return
     */
    ApiR<Void> delete(List<String> ids);

    /**
     * 分页查询用户
     * @param page
     * @param userPO
     * @return
     */
    Page<UserPO> selectPage(Page<UserPO> page, UserPO userPO);
}

